/**
 * This is class is the MainPlayer model
 * @author Sravya
 *
 */
public class MainPlayerModel 
{
        public enum Profession {HOBO, MECHANIC, STOCKBROKER}
        
        private int currProfession;
        private double cash;
        private String name;
        private String[] partyMembers;
        private int numPartyMembers;
        private final int MAX_NUM_PARTY_MEMBERS = 4;
        /**
         * This is the constructor that initializes the main player
         */
        public MainPlayerModel()
        {
                currProfession = 0;
                cash = 0;
                name = "";
                partyMembers = new String[MAX_NUM_PARTY_MEMBERS];
                numPartyMembers = 0;
                
                for(int i = 0; i < partyMembers.length; i++)
                        partyMembers[i] = ""; 
        }
        /**
         * This is the getter for the max number of party numbers
         * @return MAX_NUM_PARTY_MEMBERS                max number of party members
         */
        public final int getMaxNumPartyMembers()
        {
                return MAX_NUM_PARTY_MEMBERS;
        }
        /**
         * This is the getter for the number of party numbers
         * @return numPartyMembers              number of party members
         */
        public int getNumPartyMembers()
        {
                return numPartyMembers;
        }
        
        public void setNumPartyMembers(int numPartyMembers)
        {
        	this.numPartyMembers = numPartyMembers;
        }
        
        /**
         * This calculates the initial cash for the each profession
         */
        public void calcInitialCash()
        {
                switch (currProfession)
                {
                        case 1: cash = 100;
                        break;
                        case 2: cash = 500;
                        break;
                }
        }
        /**
         * This is the getter for the total cash
         * @return cash         cash
         */
        public double getTotalCash()
        {
                return cash;
        }
        public void setTotalCash(double newCash) {
                cash = newCash;
        }
        /**
         * This is the setter for the party members
         * @param incomingMembers
         */
        public void setPartyMembers(String[] incomingMembers)
        {
                for(int i = 0; i < MAX_NUM_PARTY_MEMBERS; i++)
                {
                        partyMembers[i] = incomingMembers[i];
                        if(!partyMembers[i].equals(""))
                                numPartyMembers++;
                }
        }
        /**
         * This is the getter for the profession
         * @return profession
         */
        public String getProfession()
        {
                return Profession.values()[currProfession].toString();
        }
        
        public int getProfessionIndex()
        {
        	return currProfession;
        }
        /**
         * This is the setter for the profession
         * @param currProfession
         */
        public void setProfession(int currProfession)
        {
                this.currProfession = currProfession;
        }
        /**
         * This is the setter for the name
         * @param name
         */
        public void setName(String name)
        {
                this.name = name;
        }
        /**
         * This is the getter for the name
         * @return
         */
        public String getName()
        {
                return name;
        }
        /**
         * This is the getter for the party members
         * @return
         */
        public String[] getPartyMembers()
        {
                return partyMembers;
        }
        
        public String getPartyMembersInOneStr()
        {
        	String output = "";
        	for(int i = 0; i < numPartyMembers; i++)
        		output += partyMembers[i] + " ";
        	
        	return output;
        }
        
        /**
         * This is the adder for the cash
         * @param cash
         */
        public void addToCash(double cash)
        {
                this.cash += cash;
        }
}